$(function(){


	setTimeout(function(){
		$('.section1').addClass('comein')
	},100)
	


	$('#fullpage').fullpage({
		navigation:true,
		loopBottom: true,
		onLeave : function(index,nextIndex,direction ){
			if(nextIndex != 1){
				$('#bg').addClass("rotate");
			}else {
				$('#bg').removeClass("rotate");
			}

			if(nextIndex == 2){
				$('.p2').css('transform','translate3d(-50%,-50%,0px) scale(1)');
			}else {
				$('.p2').css('transform','translate3d(-50%,-50%,6000px) scale(1)');
			}
			if(nextIndex == 3){
				$('.p3').css('transform', 'translateZ(-50px) rotateX(30deg)')
				// $('.p3').css("transform")
				$('.title3-2').css("transform","translate(-50%,-50%) translateZ(0px) rotateY(0deg)")
			}else {
				$('.p3').css('transform', 'translateZ(-50px) translateX(2000px) rotateX(30deg)')
				$('.title3-2').css("transform","translate(-2000px,-50%) translateZ(1200px) rotateY(-90deg)")
			}

			if(nextIndex == 4){
				$('.img4-1').css('transform', 'translateX(-50%) rotateY(0deg)')
				$('.p4').css("transform","translate(-50%,-50%) translateZ(0px) rotateX(0deg)")
			}else {
				$('.img4-1').css('transform', 'translateX(-1000px) ')
				$('.p4').css("transform","translate(1000px,-50%) translateZ(1200px) rotateX(90deg)")
			}
		}
	});
})
